export const sum = (arr) => {
    return sumIter(arr, 0)
}

const sumIter = (arr, index) => {
    if (index === arr.length) {
        return 0
    }
    return arr[index] + sumIter(arr, index + 1)
}